<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

$(function(){
	
	
	//表格加载
	$('#docIssueTable').datagrid({
	    url:'<c:url value="/docIsue/todoSubFlowData" />',
	    queryParams:getParams(),//提交参数
	    
	    toolbar:'#docIssueToolbar',//表头工具栏
	    pagination:true,//显示分页  
	    pagePosition:'bottom',//分页栏出现位置
	    pageNumber:1,//初始页码
	    pageSize:10,//初始每页显示记录数量
	    nowrap: false,//设置内容多时换行，false换行
//	    singleSelect:true,
	    columns:[[
			{field:'docId',title:'序号',width:"5%",formatter: function(value,row,index){
				return (index+1);
			}},
			{field:'docName',title:'发文标题',width:"35%",formatter: function(value,row,index){
				return "<a href='javascript:openDonePage(\""+row.docId+"\",\""+row.formId+"\")'>"+value+"</a>";
			}},
			{field:'displayNumber',title:'发文文号',width:"15%"},
			{field:'dispatchOrg',title:'发文单位',width:"15%"},
			{field:'displayNumberReceive',title:'收文文号',width:"15%"},
			{field:'fromTime',title:'收文时间',width:"15%",formatter: function(value,row,index){
				return value?dataFormatStr(new Date(value),"yyyy-MM-dd hh:mm:ss"):"";
			}}
	    ]]
	});
	
	//查询按钮绑定点击事件
	$("#searchButton").click(function(){ 
		$('#docIssueTable').datagrid({ queryParams:getParams()});
	});
});

function getParams(){
	var jsonObj=new Object();
	if($('input[name="docName"]').val()!=""){
		jsonObj.docName=$('input[name="docName"]').val();
	}
	if($('input[name="displayNumber"]').val()!=""){
		jsonObj.displayNumber=$('input[name="displayNumber"]').val();
	}
/*	if($('input[name="sendTimeStart"]').val()!=""){
		jsonObj.sendTimeStart=$('input[name="sendTimeStart"]').val();
	}
	if($('input[name="sendTimeEnd"]').val()!=""){
		jsonObj.sendTimeEnd=$('input[name="sendTimeEnd"]').val();
	}*/
	if($('input[name="dispatchOrg"]').val()!=""){
		jsonObj.dispatchOrg=$('input[name="dispatchOrg"]').val();
	}
	if($('input[name="displayNumberReceive"]').val()!=""){
		jsonObj.displayNumberReceive=$('input[name="displayNumberReceive"]').val();
	}
	return jsonObj;
}

function openDonePage(issueId,formId){
	var url=_synergyContext+"/basic/donePage?issueId="+issueId+"&formId="+formId; 
	var winFeatures = "height="+(window.screen.height-80)+"px,width="+(window.screen.width-20)+"px,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no";
	window.open(url,'_blank',winFeatures);
}